<template>
	<el-dialog title="试题评论" :visible.sync="commentVisible" :modal-append-to-body="false" width="60%">
		<div class="row-me flex-end margin-bottom20">
			<el-button type="primary" @click="addComment">新增评论</el-button>
		</div>
		<el-table :data="tableData" border class="table" ref="multipleTable" header-cell-class-name="table-header">
			<el-table-column type="expand">
				<template slot-scope="scope">
					<el-table :data="tableData" border class="table" ref="multipleTable" header-cell-class-name="table-header">
						<el-table-column prop="content" label="回复用户头像/昵称"></el-table-column>
						<el-table-column prop="content" label="回复内容"></el-table-column>
						<el-table-column prop="content" label="点赞数"></el-table-column>
						<el-table-column prop="content" label="状态"></el-table-column>
						<el-table-column prop="content" label="回复时间"></el-table-column>
					</el-table>
				</template>
			</el-table-column>
			<el-table-column label="用户头像/昵称" align="center">
				<template slot-scope="scope">
					<div class="row-me center-all">
						<el-image class="width40 height40 margin-right5" :src="scope.row.userIcon"
							:preview-src-list="[scope.row.userIcon]"></el-image>
						<span>{{scope.row.userName}}</span>
					</div>
				</template>
			</el-table-column>
			<el-table-column prop="content" label="评论内容"></el-table-column>
			<el-table-column prop="thumbUp" label="点赞数"></el-table-column>
			<el-table-column label="评论状态" align="center">
				<template slot-scope="scope">
					<el-tag :type="scope.row.status == '1' ? 'success' : 'danger'">
						{{ scope.row.status == '1' ? '已通过' : '未通过' }}
					</el-tag>
				</template>
			</el-table-column>
			<el-table-column prop="createTime" label="评论时间" width="160"></el-table-column>
			<el-table-column label="操作" width="160" align="center">
				<template slot-scope="scope">
					<el-button type="text" @click="addComment(scope.row)">编辑</el-button>
					<el-button type="text" @click="delComment(scope.row.id)">删除</el-button>
				</template>
			</el-table-column>
		</el-table>
		<div class="pagination">
			<el-pagination background layout="total,sizes, prev, pager, next" :current-page="query.pageNumber"
				:page-sizes="[30, 40, 50, 60]" @size-change="handleSizeChange" :page-size="query.pageSize" :total="pageTotal"
				@current-change="handlePageChange">
			</el-pagination>
		</div>
	</el-dialog>
</template>

<script>
	import List from 'wangeditor/dist/menus/list'
	export default {
		props: ['questionId'],
		data() {
			return {
				commentVisible: false,
				tableData: [],
				query: {
					pageNumber: 1,
					pageSize: 10
				},
				pageTotal: 0
			}
		},
		mounted() {
			this.getData()
		},
		methods: {
			show() {
				this.commentVisible = true
			},
			handleSizeChange(val) {
				this.query.pageSize = val
				this.getData()
			},
			handlePageChange(val) {
				this.query.pageNumber = val
				this.getData()
			},
			async getData() {
				const res = await this.$get('/admin/question/pageQuestionComment')
				if (res.code == 1000) {
					this.tableData = res.data
				}
			},
			//新增编辑评论
			addComment() {

			},
			//删除评论
			delComment() {

			}
		}
	}
</script>

<style>
</style>